/**
* Created by wl
* 基金储备库-管理和运行信息
*/
<template>
    <div class="ca-p-20">
        <div v-if="!showEdit">
            <div class="ca-title">
                <el-button type="text"  class="ca-edit-btn el-icon-edit ca-right" @click="showEdit = true" :disabled="!isAuthEditPre" v-if="$route.name.includes('pre-investment-funds')">编辑</el-button>
                <el-button type="text" class="ca-edit-btn el-icon-edit ca-right" @click="showEdit=true" :disabled="!isAuthEdit" v-else>编辑</el-button>
            </div>
            <div class='el-table'>
                <h2>基金治理架构</h2>
                <p>{{fundFunctionEntity.government}}</p>
            </div>
            <div class='el-table'>
                <h2>基金投资策略</h2>
                <p>{{fundFunctionEntity.investment}}</p>
            </div>
            <div class='el-table'>
                <h2>项目遴选机制</h2>
                <p>{{fundFunctionEntity.choose}}</p>
            </div>
            <div class='el-table'>
                <h2>投资决策机制</h2>
                <p>{{fundFunctionEntity.policyDecision}}</p>
            </div>
            <div class='el-table'>
                <h2>增值服务</h2>
                <p>{{fundFunctionEntity.increment}}</p>
            </div>
            <div class='el-table'>
                <h2>风险防范</h2>
                <p>{{fundFunctionEntity.risk}}</p>
            </div>
            <div class='el-table'>
                <h2>投资退出</h2>
                <p>{{fundFunctionEntity.exitInvestment}}</p>
            </div>
        </div>
        <csManagementOperation v-else @close="showEdit = false" @update="update"></csManagementOperation>
    </div>
</template>
<script type="text/ecmascript-6">
    import {api} from '../../api';
    import {STATUS_HTTP_SUCCESS, apiHttp} from '__service/csHttp';
    import { addRemind, isNoAuth } from '__service/utils';
    export default {
        data() {
            return {
                showEdit: false,
                isAuthEdit: isNoAuth('基金储备库-基金详情-编辑'),
                isAuthEditPre: isNoAuth('拟投资基金-基金详情-编辑'),
                fundFunctionEntity: {
                    choose: '',// 项目遴选机制
                    exitInvestment: '',// 投资退出
                    fundId: '',// 基金id
                    government: '',// 基金治理架构
                    id: '',// 主id
                    increment: '',// 增值服务
                    investment: '',// 基金投资策略
                    policyDecision: '',// 投资决策机制
                    risk: '',// 风险防范
                }
            }
        },
        created() {
        },
        mounted() {
            this.getInfo()
        },
        props: {

        },
        watch: {
        },
        methods: {
            async update() {
                this.showEdit = false
                await this.getInfo()
                // 添加小红点
                await addRemind({
                    dataId: this.$route.params.itemId, // 业务id
                    dataTab: 0, // tab页顺序 head 也为0 新建为'-1'
                    dataType: 4, // 1拟投资项目,2已投资项目,3母基金,4拟设立基金,5已设立基金,6客户,7潜在项目
                });
                // 根据第三方组件来调用 父组件中定义的方法 重新获取小红点
                this.$root.Dot.$emit('getDotList');
                // 添加小红点 end
            },
            getInfo() {
                apiHttp(api.CHECK_FUNCTIONINFO, {id: this.$route.params.itemId}).then(ret => {
                    if (ret.resCode === STATUS_HTTP_SUCCESS) {
                        if (ret.data) {
                            this.fundFunctionEntity = ret.data;
                        }
                    }
                })
            },
        },
        components: {
            'csManagementOperation': require('./edit'),//基金信息edit页
        },
    }
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.ca-right {
    float: right;
}
.ca-table th {
    line-height: 20px;
}
.el-table {
    display: flex;
    border-top: #dbe3ea 1px solid;
    border-right: #dbe3ea 1px solid;
    border-left: #dbe3ea 1px solid;
}
.el-table h2 {
    width: 170px;
    padding: 10px 0;
    background: #eef1f6;
    text-align: center;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-right: 10px;
    border-right: #dbe3ea 1px solid;
    font-size: 14px;
    font-weight: normal;
}
.el-table p {
    flex: 1;
    padding: 5px;
    line-height: 30px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-left: 10px;
}
.el-table:last-child {
    border-bottom: 1px solid #ccc;
} 
</style>